package com.sh.caryr.erp.helper.mybatis;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

public class AliasWrapper<T> extends EntityWrapper<T> {

    public String tabAlias;


    public AliasWrapper() {
        super();
    }

    public AliasWrapper(String alias) {
        super();
        tabAlias = alias + ".";
    }

    @Override
    public Wrapper<T> orderBy(String columns, boolean isAsc) {
        columns = tabAlias == null ? columns : tabAlias + columns;
        return orderBy(true, columns, isAsc);
    }

    @Override
    public Wrapper<T> eq(String column, Object params) {
        column = tabAlias == null ? column : tabAlias + column;
        return eq(true, column, params);
    }
}
